package aupdg.data.model.impl;

/**
 * LDG's predicate-node.
 *
 * @author AA and CJ
 */
public class AuPredicateNode extends AuGenericNode {

    /**
     * Encodes the condition or expression of the predicate node as a string.
     */
    private String condition;
    /**
     * To keep track of the place's ID, decision point, from which this node was
     * generated.
     */
    private String innerPlace;

    /**
     * Constructor. Takes the label and invokes constructor of superclass.
     *
     * @param label
     */
    public AuPredicateNode(String label) {
        super(label);
    }

    /**
     * Returns the condition or expression of the predicate node.
     *
     * @return
     */
    public String getCondition() {
        return condition;
    }

    /**
     * Sets the condition or expression of the node.
     *
     * @param condition
     */
    public void setCondition(String condition) {
        this.condition = condition;
    }

    /**
     * Sets the inner place from which this node was generated.
     *
     * @param innerPlace
     */
    public void setInnerPlace(String innerPlace) {
        this.innerPlace = innerPlace;
    }

    /**
     * Returns the inner place from which this node was generated.
     *
     * @return
     */
    public String getInnerPlace() {
        return innerPlace;
    }

    @Override
    public String toString() {
        if (condition == null) {
            return getLabel() + getId();
        }
        return getLabel() + getId() + " " + condition;
    }
}
